<jsp:include page="logincheck.jsp" />
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ page import="java.util.*" %>

<jsp:useBean id="discountList" class="se2.DiscountPlan" scope="request"/>

<html>

	<head>
		<title>Administration Console</title>
		<link rel="stylesheet" href="default.css" type="text/css" media="screen"></link>
		<script type="text/javascript" language="javascript" src="addBillingPlan.js"></script>
	</head>

	<body>
		<div id="container">
			<div id="navigation">
<p>&nbsp;</p>
<jsp:include page="navigation.jsp" />
			</div>
			
			<div id="header">				
<img src="images/header.png" />
			</div>

			<div id="content">
<!-- Main code -->

<h1>Billing Plans :: Edit</h1>

<form method="post" action="updateBillingPlanFunction.jsp" name="addBillingPlan" onSubmit="return validate();">
	<input type="hidden" name="listOfDiscountIds" />
	
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr style="background-image: url('images/tableBackground.png');">
			<td width="100" class="tableHeader">Plan name:</td>
			<td><input class="textField" type="text" id="name" name="name" onClick="this.style.background='#efefef';" onBlur="this.style.background='#fff';"></td>
		</tr>
		
		<tr>
			<td class="tableHeader">Base rate:</td>
			<td><input class="textField" type="text" id="baseRate" name="baseRate" onClick="this.style.background='#efefef';" onBlur="this.style.background='#fff';"></td>
		</tr>
	</table>

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr style="background-image: url('images/tableBackground.png');">
			<td class="tableHeader">All available discount plans</td>
			<td>&nbsp;</td>
			<td class="tableHeader">Currently added discount plans</td>
		</tr>

		<tr style="background-image: url('images/tableBackground.png');">
			<td>
				<select name="availablePlans" multiple size="20" style="width: 100%;">
<c:forEach var="discount" items="${discountList.allDiscountPlans}">
	<option value="${discount.id}">${discount.name}</option>
</c:forEach>
				</select>
			</td>
			
			<td width="150">
				<center>
					<p><input type="button" value=">>" onClick="addToList();" /></p>
					<p><input type="button" value="<<" onClick="removeFromList()" /></p>
					<p><input type="button" value="Clear All" onClick="clearList();" /></p>
				</center>
			</td>
			
			<td>
				<select id="addedPlans" name="addedPlans" multiple size="20" style="width: 100%;"></select>
			</td>
		</tr>

		<tr>
			<td colspan="3">
				<p class="floatRight"><input type="submit" value="Create Plan"></p>
			</td>
		</tr>
	</table>	
</form>

<!-- Main Code -->
			</div>

			<div id="footer">
<jsp:include page="footer.jsp" />
			</div>
		</div>
	</body>

</html>